﻿namespace Common
{
    public class ResponseTool
    {
        //状态码
        public int code { get; set; }
        //响应信息
        public string Message { get; set; }
        //是否成功
        public bool Success { get; set; }
        //存储数据
        public object data { get; set; }

        public ResponseTool()
        {

        }
        public ResponseTool(int StatuCode, string Message, bool Success, object data)
        {
            this.code = StatuCode;
            this.Message = Message;
            this.Success = Success;
            this.data = data;
        }
        public static ResponseTool Succeed()
        {
            return new ResponseTool(200, "OK", true, null);
        }
        public static ResponseTool Succeed(object data)
        {
            return new ResponseTool(200, "OK", true, data);
        }
        public static ResponseTool Fail()
        {
            return new ResponseTool(400, "NO", false, null);
        }
        public static ResponseTool Fail(object data)
        {
            return new ResponseTool(400, "NO", false, data);
        }
    }
}
